home *** CD-ROM | disk | FTP | other *** search
- /*
- FOLLOW THESE INSTRUCTIONS AND DELETE THIS SECTION
-
-
-
- LI.HLP - ASSISTANCE IN COMPILING AND LINKING THIS PROGRAM
-
-
- Enter an editor with the LI.C program source downloaded, extract each
- of the modules (perform a search for these keywords):
-
- LI.C
- LI.LNK
- SORT.C
- TMLIB.C
-
-
- Compile them.
-
- Link them together with the supplied link file.
- Select the LINK.TTP program and enter "-WITH LI.LNK".
-
- Remember to check the .C file and .LNK files for the locations of libraries,
- as mine are all in drive C: (a 500K ramdisk).
-
- It only takes me 1:52 to compile and link (includes ramdisk program/library
- load times).
- */
-
- /* LI.C V2.0
-
- List files, size, date and time
-
- V1.3 upgrades:
-
- SORT filenames, correct exiting after no files found
-
- V1.4 upgrades:
-
- correct reporting of filetype, use library modules for
- date/time/numeric conversions
-
- V2.0 upgrades:
-
- output now defaults to screen instead of printer,
- parse command switch "/OUTPUT" to direct output to screen,
- parse "/SORT" and "/NOSORT" switches to list files by when
- added to directory by DOS
-
- (c) COPYRIGHT 1986 BY THOMAS J. MYNAR
- THIS SOFTWARE MAY BE COPIED AND DISTRIBUTED FREELY WITH THE
- INCLUSION OF THIS NOTICE. NO WARRANTY AND/OR USEABILITY IS
- IMPLIED.
-
- */
-
- #include <c:gemlib.h>
- #include <c:stdio.h>
- #include <c:osbind.h>
-
- #define DAPRT 0
- #define MAXFILE 140
- #define MAXLEN 54
- #define PRT 1
- #define CON 2
- #define TRUE 1
- #define FALSE 0
-
- int maxlen, srtlen;
- char COPYRIGHT[] = { "\15\12Copyright \275 1986 Tom Mynar\277\15\12\
- Directory program V" },
- VERSION[] = { "2.0 " },
- e_fmt1[14] = { "\12\12\15Total of " },
- e_fmt2[12] = { " files, in " },
- e_fmt3[20] = { " bytes, matching " },
- e_maxfil[40]= {"\12\15Maximum files found, sorry, missing: " },
- cr_lfs[8] = { "\12\12\15" },
- errntf[18] = { "\12\15File not found" },
- prsank[18] = { ", press any key" },
- hdr[56] = { "\12\15 FILENAME SIZE DATE TIME \
- FLAGS\12\15" },
- srnend[8] = { "\12\15Done" },
- tos[20] = { "\12\15Enter Filespec: " },
- r_w_flag[8] = { " R/x\12\15" },
- am_pm_str[6] = { " xm" };
- char dta[44], dirspec[64], out_buff[132], dirlst[MAXLEN*MAXFILE],
- fmt_num[10], fmt_nam[14], fmtdat[12], fmttim[12], cmnd[255],
- cmnval[255];
- char *filename, *at_buff, *at_fmt, *at_nam, *at_srch, *at_bu2, *datstr,
- *timstr;
- long error, filesize, tot_siz, tot_fil, F_SUBDIR = 0x1F;
- int waitans, done, sizsrch, noopt, noval, outdev, wntsrt, swpos, nextsw;
- short int readonly = 0x01, subdir = 0x10, allfile = 0x00; vollab = 0x08;
- short int attribute, drive_no, lincnt;
- unsigned short int date, time, index;
-
- /*
- put one char to printer
- */
- static void putlst(c)
- char c;
- { Bconout(DAPRT, c); }
-
- /*
- Put a null terminated string to the printer
- */
- static void prtstr(s)
- char *s;
- { if (outdev == PRT)
- { while (*s) putlst(*s++); }
- else
- { if (outdev == CON)
- { Cconws( s ); }
- }
- }
-
- /*
- function to decode the DTA into file specifications of name
- size, date, time and attribute
- */
- dec_file()
- {
- char one_char[2];
- long int PS_date, PS_time;
-
- at_bu2 = &fmt_num[0]; filesize = *(long*) (&dta[26]);
- lngstr( at_bu2, filesize );
- strfil( at_bu2, at_bu2, 0x09, " " );
- filename = &dta[30];
- one_char[1] = dta[21];
- one_char[0] = '\0';
- attribute = *(short int *) (&one_char[0]);
- date = *(short int *) (&dta[24]);
- time = *(short int *) (&dta[22]);
- datstr = &fmtdat[0];
- timstr = &fmttim[0];
- PS_date = date; cnvdate( datstr, PS_date, 0x00 );
- PS_time = time; cnvtime( timstr, PS_time, 0x00 );
- }
-
- /*
- save filename, get next filename
- */
-
- static void loop()
- {
- done = 0;
- /*
- until end of file searches matching
- */
- while (done == 0)
- { dec_file();
-
- for (index=MAXLEN-10;index<=130;index++) out_buff[index]='\0';
- for (index=0;index<=MAXLEN-10;index++) out_buff[index]=' ';
-
- /*
- determine if sub directory or not (affects filename printing)
- */
- if ( (attribute & subdir) == subdir )
- { at_buff=&out_buff[1]; strcpy( at_buff, filename );
- at_bu2=&out_buff[15]; strcpy( at_bu2, "<DIR>");
- /*
- put the filename at char pos 1
- put the text "DIR" where size goes
- */
- }
- else
- { if ( (attribute & vollab) == vollab )
- { at_buff=&out_buff[0];
- strcpy( at_buff, filename );
- at_bu2=&out_buff[15]; strcpy( at_bu2, "<LABEL>");
- /*
- put filename at beginning
- put the text "LABEL" where size goes
- */
- }
- else
- { at_buff=&out_buff[3];
- strcpy( at_buff, filename ); at_buff=&out_buff[15];
- at_bu2=&fmt_num[0]; strcpy( at_buff, at_bu2 );
- /*
- put filename right shifted
- */
- }
- }
-
- /*
- determine read/write or read/only flag
- add put string together with all substrings formatted
- */
- if (attribute & readonly)
- { r_w_flag[3] = 'O'; } /* read only */
- else
- { r_w_flag[3] = 'W'; } /* read/write */
- for (index=1;index<=24;index++)
- {if (out_buff[index]==0) {out_buff[index]=' ';}}
- at_buff = &out_buff[26]; strncpy( at_buff, datstr, 0x09 );
- out_buff[35] = ' ';
- at_buff = &out_buff[36]; strncpy( at_buff, timstr, 0x08 );
- at_buff = &out_buff[44]; at_bu2=&r_w_flag[0]; strcpy( at_buff, at_bu2 );
- lincnt = lincnt+1;
- if (lincnt == MAXFILE)
- { Cconws( e_maxfil ); Cconws( filename );
- Cconws( "\12\15" ); lincnt = lincnt-1;
- }
- /*
- append current line to buffer, go for next file
- */
- at_buff = &out_buff[0];
- at_bu2=&dirlst[(lincnt-1)*MAXLEN]; dirlst[(lincnt-1)*MAXLEN]='\0';
- strcpy( at_bu2, at_buff );
- tot_siz = tot_siz + filesize;
- tot_fil = tot_fil + 1;
- index = Dsetdrv( drive_no ); error = Fsnext();
- if (error == -49)
- { done = -1; /* end loop */ }
- else
- { if (error < 0 )
- { rpterr( "F_NEXT", error );
- }
- }
- }
- }
-
- /* MAIN LOOP */
-
- main( argc, argv )
- int argc;
- char *argv[];
- { appl_init(); /* Set the system up to do GEM calls */
-
- if (argc != 2) /* print header if entry with no parms */
- { at_buff = ©RIGHT[0]; Cconws( at_buff );
- at_buff = &VERSION[0]; Cconws( at_buff );
- }
- error = Fsetdta(dta); /* setup data area */
- if (error < 0)
- { rpterr( "F_SETDTA", error );
- }
-
- while (0 == 0) /* forever */
- { lincnt = 0; tot_siz = 0; tot_fil = 0;
- for (index=0;index<=131;index++) out_buff[index]='\0';
- for (index=0;index<=63;index++) dirspec[index]='\0';
-
- /*
- ask user for filename specification and look for the first file
- */
- at_fmt = &tos[0]; Cconws( at_fmt );
- if (argc == 2)
- { at_buff = &out_buff[2]; out_buff[2] = '\0';
- strcpy( at_buff, argv[1] ); Cconws( at_buff );
- }
- else
- { at_buff = &out_buff[0]; out_buff[0] = '\62';
- Cconrs( at_buff );
- }
-
- /*
- see if a drive specified or set to active
- */
- if (out_buff[3] == ':')
- { drive_no = 1;
- drive_no <<= ((out_buff[2] || 40) - 'a');
- }
- else
- { drive_no = Dgetdrv();
- }
- /*
- decode all switches passed (/O redirect output, /N /S sort toggle)
- */
- outdev = CON; wntsrt = TRUE;
- nextsw = getsw( at_buff, cmnd, cmnval );
- if (noopt == 0)
- { swpos = pos( at_buff, "/", 0x0 ); *(at_buff+swpos)='\0';
- done = FALSE;
- while (done == FALSE)
- {
- if (cmnd[0] == 'N') wntsrt = FALSE;
- if (cmnd[0] == 'S') wntsrt = TRUE;
- if (cmnd[0] == 'O') /* output command ? */
- { if (noval) /* no value, make it screen */
- { outdev = CON;
- }
- else
- { if (cmnval[0] == 'P')
- { outdev = PRT;
- }
- if (cmnval[0] == 'C')
- { outdev = CON;
- }
- }
- }
- at_buff = at_buff + nextsw - 1;
- nextsw = getsw( at_buff, cmnd, cmnval );
- if (noopt != 0)
- { done = TRUE;
- }
- else
- { at_buff = at_buff + nextsw - 1;
- }
- }
- }
- at_buff = &out_buff[2]; at_bu2 = &dirspec[0]; strcpy( at_bu2, at_buff );
-
- /*
- search for the first folder
- */
- index = Dsetdrv( drive_no ); error = Fsfirst( at_buff, F_SUBDIR );
- /* set drive, get first file ****** BUG HERE, should only get dirs */
- if (error < 0)
- { if (error != -33)
- { rpterr( "F_SFIRST", error );
- }
- else
- { at_buff = &errntf[0]; Cconws( at_buff );
- at_buff = &prsank[0]; Cconws( at_buff );
- waitans = getch();
- if (argc == 2)
- { exit(0);
- }
- /* tell user the end */
- }
- }
- else
- {
-
- /*
- print header to printer, lookup and decode filenames
- */
- at_fmt = &hdr[0];
- prtstr( at_fmt );
- loop();
- if (wntsrt == TRUE)
- { maxlen = MAXLEN;
- srtlen = 14;
- SORT( &dirlst[0], lincnt-1, maxlen, srtlen );
- }
- /*
- print all filenames
- */
- for (index=0;index<lincnt;index++)
- { at_buff=&dirlst[(index)*MAXLEN]; prtstr( at_buff );
- }
- /*
- print totals, ask if we continue now
- */
- at_fmt = &e_fmt1[0]; prtstr( at_fmt );
- at_buff = &out_buff[0]; lngstr( at_buff, tot_fil );
- prtstr( at_buff ); at_fmt = &e_fmt2[0]; prtstr( at_fmt );
- at_buff = &out_buff[0]; lngstr( at_buff, tot_siz );
- prtstr( at_buff ); at_fmt = &e_fmt3[0]; prtstr( at_fmt );
- at_srch = &dirspec[0]; prtstr( at_srch );
- at_bu2 = &cr_lfs[0]; prtstr( at_bu2 );
- at_buff = &srnend[0]; /* tell user we're done */
- if (argc != 2) /* if entry with a command */
- { Cconws( at_buff ); at_buff = &prsank[0];
- Cconws( at_buff ); waitans = getch();
- if ( waitans == 3 )/* exit if CTRL/C */
- exit(0);
- }
- else
- { exit(0);
- }
- }
- } /* end of forever */
- } /* end of main */
-
- /*
-
- *
- * LI.LNK - Control file for linking C:LI.BIN
- *
- * Step 1 - initialization
- * =======================
- *
- * C initialization must be included first.
- *
- INPUT c:\startup.bin
- *
- * Step 2 - user modules
- * =====================
- *
- INPUT c:\LI
- INPUT c:\TMLIB
- INPUT c:\SORT
- *
- * Step 3 - C library
- * ==================
- *
- * C library - must always be included.
- *
- LIBRARY c:\clib.bin
- *
- * Step 4 - GEM graphics library
- * =============================
- *
- * GEM graphics library
- *
- LIBRARY c:\gemlib.bin
- *
-
- */
-
-
- /* SORT.C V1.0
-
- Sort array passed
-
- Calling format:
-
- SORT( CHAR *pointer to string array,
- INT # elements,
- INT maximum length of string,
- INT maximum number of characters to compare
- )
-
-
- (c) COPYRIGHT 1986 BY THOMAS J. MYNAR
- THIS SOFTWARE MAY BE COPIED AND DISTRIBUTED FREELY WITH THE
- INCLUSION OF THIS NOTICE. NO WARRANTY AND/OR USEABILITY IS
- IMPLIED.
-
- */
-
- extern void SORT( dirlst, lincnt, maxlen, match_len )
- char *dirlst;
- int lincnt, maxlen, match_len;
- {
- int flag_word, swapped;
- unsigned short int jindex, index;
- char tmpstr[255], *at_temp, *at_buff, *at_bu2;
-
- for (index=0;index<=lincnt-1;index++)
- { swapped = 0;
- for (jindex=index+1;jindex<=lincnt;jindex++)
- { at_buff = dirlst + (index * maxlen);
- at_bu2 = dirlst + (jindex * maxlen);
- flag_word = strncmp(at_buff, at_bu2, match_len);
- if ( flag_word > 0 )
- { at_temp = &tmpstr[0];
- strncpy( at_temp, at_bu2, maxlen );
- strncpy( at_bu2, at_buff, maxlen );
- strncpy( at_buff, at_temp, maxlen );
- swapped = -1;
- }
- }
- if (swapped == 0)
- return;
- }
- }
-
- /* TMLIB.C V1.1
-
- Tom Mynar's Library
-
- CNVTIME - convert time LONGWORD to string
- CNVDATE - convert date LONGWORD to string
- GETSW - extract switch and value from string
- INTSTR - convert short integer to string
- LNGSTR - convert long integer to string
- POS - locate character in string
- RPTERR - report error and text, abort program
- STRFIL - fill a string, right justified
-
- (c) COPYRIGHT 1986 BY THOMAS J. MYNAR
- THIS SOFTWARE MAY BE COPIED AND DISTRIBUTED FREELY WITH THE
- INCLUSION OF THIS NOTICE. NO WARRANTY AND/OR USEABILITY IS
- IMPLIED.
-
- Modification History
-
- V1.1 11-Sep-86 Correct handling of bad dates (they can kill you).
-
- */
-
- #include <c:gemlib.h>
- #include <c:stdio.h>
- #include <c:osbind.h>
-
- char month_tx[38] = {"JanFebMarAprMayJunJulAugSepOctNovDec"};
-
- /* Convert numeric string to right justified filled numeric string
-
- ( INPUT STRING CAN BE NO LONGER THAN 255 BYTES !!! )
-
- char *AT_BUFF, *IN_BUFF, *FILLCHAR or literal in quotes
- int FILVAL or literal long value
-
- AT_BUFF = &youroutputsrtring[?];
- IN_BUFF = &yournumericstring[?];
- strfil( AT_BUFF, IN_BUFF, FILVAL, *FILLCHAR );
- or
- strfil( AT_BUFF, IN_BUFF, 0x05, "0" );
-
- FILVAL is how many characters to put in front
- FILLCHAR is the character to fill with (usually 0 or <SPACE>)
-
- Uses a temporary string so use can pass the same string
- to both string pointers.
-
- */
- extern void strfil( strptr, strnum, filval, filchr )
- char *strptr, *strnum, *filchr;
- int filval;
- {
- unsigned int index, tmplen;
- char tmpstr[255], *tmpptr;
-
- tmpptr = &tmpstr[0]; strncpy( tmpptr, strnum, filval+1 );
- tmplen = filval - strlen( tmpstr );
- if ( *tmpstr == '-' )
- { if ( *filchr != ' ' )
- { *strptr = '-'; strptr += 1; tmplen -= 1; tmpptr += 1;
- }
- }
- for (index=0;index<tmplen;index++)
- { *strptr = *filchr; strptr += 1;
- }
- for (index=tmplen;index<=filval;index++)
- { *strptr = *tmpptr; tmpptr += 1; strptr +=1;
- }
- *strptr = '\0';
- }
-
- /* Convert signed short integer to string.
-
- char *AT_BUFF;
- short int INTEGER;
-
- AT_BUFF = &yourstring[pointer];
- intstr( AT_BUFF, INTEGER );
-
- Converts up to 5 digits and a preceeding sign.
-
- */
- extern void intstr( strptr, intval )
- char *strptr;
- short int intval;
- {
- char tmpstr[6];
- int k, j, flag, wrkint, loop_cnt;
-
- flag = 0; wrkint = intval; j = 0;
- if (wrkint < 0)
- { wrkint = -wrkint;
- }
- while (!flag)
- { tmpstr[j]=(wrkint%10)+48;
- wrkint/=10;
- j++;
- if (wrkint == 0)
- { flag = -1;
- if (intval<0)
- { tmpstr[j] = '-'; j++;
- }
- tmpstr[j] = '\0';
- loop_cnt = strlen(tmpstr)-1;
- for (k=loop_cnt; k>=0; k--)
- { *strptr = tmpstr[k]; strptr += 1;
- }
- *strptr = '\0';
- }
- }
- }
-
- /* Convert signed long integer to string.
-
- char *AT_BUFF;
- long int INTEGER;
-
- AT_BUFF = &yourstring[pointer];
- lngstr( AT_BUFF, INTEGER );
-
- Converts up to 9 digits and a preceeding sign.
-
- */
- extern void lngstr( strptr, intval )
- char *strptr;
- long int intval;
- {
- char tmpstr[10];
- int k, j, flag, loop_cnt;
- long int wrkint;
-
- flag = 0; wrkint = intval; j = 0;
- if (wrkint < 0)
- { wrkint = -wrkint;
- }
- while (!flag)
- { tmpstr[j]=(wrkint%10)+48;
- wrkint/=10;
- j++;
- if (wrkint == 0)
- { flag = -1;
- if (intval<0)
- { tmpstr[j] = '-'; j++;
- }
- tmpstr[j] = '\0';
- loop_cnt = strlen(tmpstr)-1;
- for (k=loop_cnt; k>=0; k--)
- { *strptr = tmpstr[k]; strptr += 1;
- }
- *strptr = '\0';
- }
- }
- }
-
- /* Convert long word date to string
-
- AT_BUFF = &youroutputbuffer[?]
- PS_DATE = yourlongworddate (sysdate or directory date)
- YERFLAG = yourlongwordconstant,
- 0 to format year 8x
- not 0 to format year 198x
-
- cnvdate( AT_BUFF, PS_DATE, 0x?? );
-
- */
- extern void cnvdate( strptr, PS_date, yerflag )
- long int PS_date;
- int yerflag;
- char *strptr;
- {
- char tmpstr[4], *at_bu2;
- unsigned short int date;
- short int day, month, year;
-
- if (PS_date > 0x3000)
- { strcpy( strptr, "00-xxx-00");
- }
- else
- {
- date = PS_date; date >>= 9; year = date; year = year & 0xA3;
- /*
- convert to (uns)short, shift over, move to year, AND off anything > 1999
- */
- if ( yerflag ) year = year + 1980;
- else year = year + 80;
- date = PS_date; date <<= 7; date >>= 12; month = date;
- date = PS_date; day = date & 0x1F;
- at_bu2 = &tmpstr[0]; intstr( at_bu2, day );
- at_bu2 = &tmpstr[0]; strfil( strptr, at_bu2, 0x02, "0" );
- strptr +=2; *strptr = '-'; strptr += 1;
- /*
- if valid month, copy string otherwise make "x"'s
- */
- if ((month>0) && (month<13))
- { at_bu2 = &month_tx[(month-1)*3]; strncpy( strptr, at_bu2, 0x03 );
- }
- else
- {
- strcpy( strptr, "XXX" );
- }
- strptr += 3; *strptr = '-'; strptr += 1;
- at_bu2 = &tmpstr[0]; intstr( at_bu2, year );
- at_bu2 = &tmpstr[0];
- if ( yerflag )
- { strfil( strptr, at_bu2, 0x04, " " );
- strptr += 4; *strptr = '\0';
- }
- else
- { strfil( strptr, at_bu2, 0x02, "0" );
- strptr += 2; *strptr = '\0';
- }
- }
- }
-
- /* Return time from longword
-
- AT_BUFF = &yourstringbuffer[?]
- PS_TIME = longwordtime from system or directory call
- TIMFLAG = longword constant formatting flag
- If bit 0 on, return in military (HH:MM) else (HH:MM a/pm)
- If bit 1 on, return seconds (HH:MM:SS) or (HH:MM:SS a/pm)
-
- */
-
- #define MILFORMAT 0x01
- #define WANTSECND 0x02
-
- extern void cnvtime( strptr, PS_time, timflag )
- long int PS_time;
- int timflag;
- char *strptr;
- {
- unsigned short int time;
- short int hour, minute, second, pm_flag;
- char tmpstr[4], *at_bu2;
-
- pm_flag = 0x00; time = PS_time; time >>= 11; hour = time;
- at_bu2 = &tmpstr[0]; intstr( at_bu2, hour );
- if ( ( timflag & MILFORMAT ) == 0 )
- { if (hour > 12)
- { at_bu2 = &tmpstr[0]; pm_flag = 0xFF;
- intstr( at_bu2, hour - 12 );
- }
- }
- at_bu2 = &tmpstr[0]; strfil( strptr, at_bu2, 0x02, "0" );
- time = PS_time; time <<= 5; time >>= 10; minute = time;
- strptr += 2; *strptr = ':'; strptr += 1;
- at_bu2 = &tmpstr[0]; intstr( at_bu2, minute );
- at_bu2 = &tmpstr[0]; strfil( strptr, at_bu2, 0x02, "0" ); strptr += 2;
- if ( timflag & WANTSECND )
- { time = PS_time; second = (time & 0x1F) * 2;
- at_bu2 = &tmpstr[0]; intstr( at_bu2, second );
- *strptr = ':'; strptr += 1;
- at_bu2 = &tmpstr[0]; strfil( strptr, at_bu2, 0x02, "0" );
- strptr += 2;
- }
- if ( ( timflag & MILFORMAT ) == 0 )
- { *strptr = ' '; strptr += 1;
- if ( pm_flag )
- { *strptr = 'p';
- }
- else
- { if ( (hour == 12) && (minute == 0) )
- { *strptr = ' ';
- }
- else
- { *strptr = 'a';
- }
- }
- strptr += 1; *strptr = 'm'; strptr += 1;
- }
- *strptr = '\0';
- }
-
- /* Return switch and corresponding value from command line
-
- INT NEXTSW;
- CHAR *AT_COMMANDLINE, *AT_SWITCH, *AT_SWITCHVALUE
- INT NOOPT, NOVAL; (external references)
-
- NEXTSW = getsw( AT_COMMANDLINE, AT_SWITCH, AT_SWITCHVALUE );
-
- if (noopt) then no switch found
- if (noval) then no value assigned
-
- NEXTSW is the byte position in AT_COMMANDLINE of the next
- switch (the slash) or will be zero if no more found.
-
- REMEMBER that NOOPT and NOVAL must be external integers !
-
- */
-
- extern int getsw( arg1, arg2, arg3 )
- char *arg1, *arg2, *arg3;
- {
- int slapos, eqpos, nxtsw;
- extern int noval, noopt;
-
- noval = 0x0; noopt = 0x0; nxtsw = 0;
- slapos = pos( arg1,"/", 0x0 );
- if (slapos == 0)
- { noopt = 0xFFFF; noval = 0xFFFF;
- }
- else
- { eqpos = pos( arg1, "=", slapos );
- if (eqpos == 0)
- { eqpos = strlen( arg1 ) + 1;
- noval = 0xFFFF;
- }
- nxtsw = pos( arg1, "/", slapos+1 );
- if (nxtsw == 0) nxtsw = strlen( arg1 ) + 1;
- strncpy( arg2, arg1+slapos+1, eqpos - slapos - 1 );
- strncpy( arg3, arg1+eqpos+1, nxtsw - eqpos - 1 );
- }
- if (nxtsw >= strlen( arg1 ))
- return( 0x0 );
- else return( nxtsw );
- }
-
- extern int pos( srhstr, mtchcr, strtps )
- char *srhstr, *mtchcr;
- int strtps;
- {
- int index, stppos, fndpos;
- char str1[2], str2[2], *at_str;
- str2[0] = *mtchcr; str1[1] = '\0'; at_str = srhstr+strtps;
- stppos = strlen( srhstr ); fndpos = 0;
- index = strtps;
- while ( (fndpos == 0) && (index<stppos) )
- { if (index<stppos)
- { str1[0] = *(srhstr+index);
- if ( str1[0] == str2[0] ) fndpos = index;
- index += 1;
- }
- }
- return( fndpos );
- }
-
- /* Function to dump error and exit program */
-
- extern void rpterr( tmpstr, error )
- char *tmpstr;
- int error;
- {
- char *errmsg, msgtxt[255];
- int waitchar;
-
- Cconws( "\nError from " ); Cconws( tmpstr ); Cconws( " = " );
- errmsg = &msgtxt[0]; lngstr( errmsg, error ); Cconws( errmsg );
- waitchar = getch(); exit(0);
- }
- əəəəəəəəəəəəəəəəəəəəəəəəəə